package Zbiory;

public class Element implements Comparable<Element>{

	private float wartosc;
	private float przynaleznosc;
	
	public Element() {
		super();
	}
	public Element(float wartosc, float przynaleznosc) {
		super();
		this.wartosc = wartosc;
		this.przynaleznosc = przynaleznosc;
	}
	public Element(Element element){
		this.wartosc = element.wartosc;
		this.przynaleznosc = element.przynaleznosc;
	}
	public float getWartosc() {
		return wartosc;
	}
	public float getPrzynaleznosc() {
		return przynaleznosc;
	}
	
		
	@Override
	public String toString() {
		return "Element [przynaleznosc=" + przynaleznosc + ", wartosc="
				+ wartosc + "]";
	}
	@Override
	public int compareTo(Element arg0) {
		if(this.equals(arg0))
			return 0;
		Element elem = (Element)arg0;
		if(wartosc > elem.wartosc){
			return 1;
		}else{
			return -1;
		}
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Float.floatToIntBits(wartosc);
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Element other = (Element) obj;
		if (Float.floatToIntBits(wartosc) != Float
				.floatToIntBits(other.wartosc))
			return false;
		return true;
	}
}
